#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include "ui_mainwindow.h"
#include <QMainWindow>
#include <QTcpSocket>
#include <QFileInfo>
#include <QStandardItem>
#include <QDir>
#include <QTimer>


class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    void updateFile();
    void loadDir();

private slots:
    void on_btn_search_clicked();

    void on_btn_loadDir_clicked();


    void on_btn_send_clicked();

protected slots:
    void onConnected();
    void onDisconnected();
    void onReadyRead();
    void onSocketError(QAbstractSocket::SocketError error);

private:
    void initConnections();
    Ui::MainWindow *ui;
    QString m_strDataPath;

    QStandardItemModel *m_model;
    QTimer m_timer;
    QString m_cur;
    QFileInfoList lFilesInfo;
    QTcpSocket *m_socket;
    QByteArray m_packageData;
    QString m_lastPath;
};
#endif // MAINWINDOW_H
